package com.runmi.webchat.aftersale.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

//@EnableWebMvc
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {

    @Value("${swagger.title:OPENAPI-API}")
    private  String title;
    @Value("${swagger.desc:OPENAPI}")
    private  String desc;
    @Value("${swagger.contact.name:luojianhui}")
    private  String contactName;
    @Value("${swagger.contact.url:*}")
    private  String contactUrl;
    @Value("${swagger.contact.email:luojianhui@wanda.cn}")
    private  String contactEmail;
    @Value("${swagger.license:Apache 2.0}")
    private  String licenseName;
    @Value("${swagger.license.url:http://www.apache.org/licenses/LICENSE-2.0.html}")
    private  String licenseUrl;
    @Value("${swagger.termsOfService:}")
    private  String termsOfService;
    @Value("${swagger.version:1.0.0}")
    private  String version;

    /**
     * 可以配置多个Docket
     * @return 返回swagger的容器对象
     */
    @Bean
    public Docket getApiInfo() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("logistic-API")
                .select()
                .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build()
                .apiInfo(apiInfo());
    }

    ApiInfo apiInfo() {
        return new ApiInfoBuilder()
            .title("SCM-API")
            .description("SCM-API")
            .license("")
            .licenseUrl("前台API")
            .termsOfServiceUrl("")
            .version("1.0.0")
            .contact(new Contact("", "", ""))
            .build();
      }
    


}